Repository navigation
Keep the lint files Codacy reads to packages Codacy installs - #178
Conversation
Codacy reads phpcs.xml and phpmd.xml, but it installs no WordPress coding standards, no PHPCSExtra, and only PHPMD 2, so every analysis failed for both tools and Codacy checked no PHP with them. - PHPCS: phpcs-wordpress.xml is the former phpcs.xml, which composer and CI run. phpcs.xml holds the rules from PHPCS's own standards and VariableAnalysis that the WordPress standards apply, with their settings and the tab width, plus PHPCompatibilityWP. - PHPMD: LongMethodName, a PHPMD 3 rule, moves to phpmd-extra.xml; composer and CI pass both files. .github/scripts/codacy-configs.py regenerates phpcs.xml's rules from phpcs-wordpress.xml, and CI fails when they are out of date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 44 |
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (6f04788) 877 663 75.60% Head commit (88620b9) 877 (+0) 663 (+0) 75.60% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#178) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Thanks for contributing to EngineScript Site Optimizer! Before we review:
Security Reminder
We'll review your PR soon. |
Codacy's Opengrep reports a subprocess call without a static string and the xml import as it does for any script; both are false positives here (a fixed argument list, and escaping only). nosemgrep notes sit beside the existing nosec notes, matching enginescript-site-exporter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Codacy reads
phpcs.xmlandphpmd.xml(the "Configuration file" setting is on for each), but it installs no WordPress coding standards, no PHPCSExtra, and only PHPMD 2. Codacy's analysis log for6f04788shows both tools failing:Referenced sniff "WordPress-Extra" does not existLongMethodName, a PHPMD 3 ruleSo Codacy checked none of the plugin's PHP with those tools.
Each tool now has a file Codacy can run and a full file that composer and CI run. The plugin's own checks are unchanged.
phpcs.xml: the rules from PHPCS's own standards and VariableAnalysis that the WordPress standards apply, with their exact settings and the 4-column tab width, plus PHPCompatibilityWPphpcs-wordpress.xml(the formerphpcs.xml)phpmd.xmlphpmd.xmlplusphpmd-extra.xml(LongMethodName, 50 characters).github/scripts/codacy-configs.pyregenerates the rules inphpcs.xmlfromphpcs-wordpress.xml. It reads PHPCS's loaded ruleset through.github/scripts/phpcs-ruleset-dump.php, a report class. The "Run PHPCS" step fails when the copy is out of date, for example after a Dependabot update to the WordPress standards.Codacy still can't run any WordPress-specific rule; those keep running only in CI.
Testing
phpcs.xml: no findings on the plugin. Its loaded ruleset matchesphpcs-wordpress.xmlfor all 213 rules from Codacy-installed standards (same sniffs, properties, severities and types). Every listed sniff is in Codacy's PHPCS catalog. A test file triggers its indentation, spacing, docblock and unused-variable rules.composer check-all(PHPCS, PHPMD, Psalm, PHPStan, Rector, 153 PHPUnit tests), markdownlint, Ruff, strict mypy, Bandit through Prospector, yamllint, actionlint, zizmor (no change) and gitleaks pass. A test file confirmsLongMethodNamefires throughphpmd-extra.xml.After merge, the Codacy log for the merge commit should show PHP_CodeSniffer and PHP Mess Detector as
success.🤖 Generated with Claude Code